package main

import "fmt"

//使用方式
func main() {
	//方式一
	var mapDemo map[string]string
	mapDemo = make(map[string]string, 10)
	mapDemo["a"] = "hello"
	mapDemo["b"] = "hello"
	fmt.Println(mapDemo)

	//方式二
	m := make(map[string]string, 10)
	m["0"] = "beijing"
	m["1"] = "shanghai"
	fmt.Println(m)

	//方式三
	var citys map[string]string = map[string]string{
		"a": "haha",
		"b": "cdsfhi",
	}
	citys["c"] = "fsf"
	//var citys = map[string]string{
	//	"a":"haha",
	//	"b":"cdsfhi",
	//}
	fmt.Println(citys)

	//二维map
	student1 := make(map[string]string, 10)
	student2 := make(map[string]string, 10)
	col := make(map[string]map[string]string, 10)
	student1["stuno"] = "1001"
	student1["stuName"] = "ceshi"
	student1["stuAddres"] = "henan"
	student2["stuno"] = "1002"
	student2["stuName"] = "ceshi2"
	student2["stuAddres"] = "henan2"

	col["student1"] = student1
	col["student2"] = student2
	fmt.Println(col)

	//还可以取出具体的值
	fmt.Println(col["student1"])
	fmt.Println(col["student1"]["stuName"])
}
